<?php
// Begin custom setting
add_action('admin_menu', 'media_admin_menu'); //Add new menu block to admin side
function media_admin_menu() {
	do_action('media_admin_menu');	
}
add_action('media_admin_menu', 'register_custom_menu_page');
function register_custom_menu_page(){
	if(function_exists(add_object_page))
       add_object_page( 'Media Custom', 'Settings Custom', 7, 'settings', 'banner_slider', '', 101 ); // title of new sidebar
	else
       add_menu_page( 'Media Custom', 'Settings Custom', 7, 'settings', 'banner_slider', '', 101 ); // title of new sidebar
}

add_action('media_admin_menu', 'register_submenu_banner_slider');
function register_submenu_banner_slider()
{
	add_submenu_page('settings', 'Banner slider settings', 'Banner slider', 7, 'settings', 'banner_slider'); 
	//add_submenu_page('settings', 'Partner slider settings', 'Partner slider', 7, 'settings', 'partner_slider');
}

add_action('media_admin_menu', 'register_submenu_partner_slider');
function register_submenu_partner_slider()
{
	add_submenu_page('settings', 'Partner slider settings', 'Partner slider', 7, 'partner', 'partner_slider'); 
}

add_action('media_admin_menu', 'register_submenu_partner_image');
function register_submenu_partner_image()
{
	add_submenu_page('settings', 'Partner slider settings', 'Partner image', 7, 'image', 'partner_image'); 
}

add_action('media_admin_menu', 'register_submenu_partner_links');
function register_submenu_partner_links()
{
	add_submenu_page('settings', 'Partner slider settings', 'Insert links', 7, 'links', 'partner_links'); 
}

add_action('media_admin_menu', 'register_submenu_other_settings');
function register_submenu_other_settings()
{
	add_submenu_page('settings', 'Layout Settings', 'Layout Settings', 7, 'layout', 'other_settings');
}
// End custom setting
// Begin Attribuill custom setting
function other_settings() {
	global $title;
	echo '<h1>'. $title .'</h1>';
	$layout	= array();
	if ( isset($_POST['saved']) ) {
		echo '<div id="message" class="updated fade"><p><strong>Đã lưu thay đổi</strong></p></div>';
		
		$layout['ym_chat']	= $_POST['ym_chat'];
		$layout['skype_call']	= $_POST['skype_call'];
		$layout['copyright']	= $_POST['copyright'];
		$layout['facebook']	= $_POST['facebook'];
		$layout['twitter']	= $_POST['twitter'];
		$layout['youtube']	= $_POST['youtube'];
		$layout['address']	= $_POST['address'];
		//....
		update_option('_layout_settings', $layout);
	}
	if( !count($layout) ) 
	$layout	= get_option('_layout_settings');
	$form_url	= "admin.php?page=layout";
	$editor_arg = array(
		'textarea_rows' => 8,
		'teeny' => true,
		'media_buttons' => false
		);
	?>
    <form method="post" action="<?php echo $form_url; ?>" id="form"> 
    	<table cellpadding=0 cellspacing=0 width="100%">
        	<tr><th colspan=2 align="left"><br />Support Online:<hr></th></tr>
            <tr><td width="50%">
                   <table class="optiontable">
                         <tr><td>Nick YM Chat:</td>
                            <td><input type="text" name="ym_chat" value="<?php echo $layout['ym_chat']; ?>" style="width:200px"></td></tr>
                         <tr><td>Nick Skype:</td>
                            <td><input type="text" name="skype_call" value="<?php echo $layout['skype_call']; ?>" style="width:200px"></td></tr>
                    	 <tr><td>Copyright text:</td>
                            <td><input type="text" name="copyright" value="<?php echo $layout['copyright']; ?>" style="width:200px"></td></tr>
                    </table>
                </td><td>
            		<table class="optiontable">
                    	<tr><td>Link facebook:</td>
                            <td><input type="text" name="facebook" value="<?php echo $layout['facebook']; ?>" style="width:200px"></td></tr>
                        <tr><td>Link Twitter:</td>
                            <td><input type="text" name="twitter" value="<?php echo $layout['twitter']; ?>" style="width:200px"></td></tr>
                        <tr><td>Link youtube:</td>
                            <td><input type="text" name="youtube" value="<?php echo $layout['youtube']; ?>" style="width:200px"></td></tr>
                    </table>
                </td><td>
            <tr><td><?php wp_editor( stripslashes($layout['address']), 'address', $editor_arg ); ?><br /></td></tr>
        </table><br />
        <div><input name="saved" type="submit" value="Save changes" />
        <input type="hidden" name="action" value="save" />
        </div>
    </form>
    <?php
}

function banner_slider() {
	global $title, $table_prefix, $wpdb;
	echo '<h1>'. $title .'</h1><hr />';
	$groupid = 1;
	$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid = ". $groupid);
	?>
    <input type="button" value="Add new banner" class="button" onclick="addRow();" />
    <em style="font-size:10px;">Lưu ý: Kích thước hình hiển thị theo chuẩn ngang 698 pixel, kích thước chiều cao nên đồng bộ với nhau.</em>
    <table width="100%" class="tblDict">
    	<tr><th>Title</th><th>Source</th><th>Link</th><th width="22">Edit</th><th width="22">Del</th></tr>
        <?php 
		foreach ( $mysql as $adv ) { ?>
        <tr id="dbAdv_<?php echo $adv->id; ?>" align="center">
        	<td id="adv1_<?php echo $adv->id; ?>"><?php echo $adv->title; ?></td>
            <td id="adv3_<?php echo $adv->id; ?>"><a id="adv31_<?php echo $adv->id; ?>" href="<?php echo $adv->source; ?>" target="_blank"><img src="<?php if( $adv->source ): echo HOME_URL .'/timthumb.php?src='. $adv->adv_Value .'&h=60&q=100'; endif; ?>" alt="" /></a></td>
            <td id="adv4_<?php echo $adv->id; ?>"><a id="adv41_<?php echo $adv->id; ?>" href="<?php echo $adv->url; ?>" target="_blank"><?php echo $adv->url; ?></a></td>
            <td id="adv2_<?php echo $adv->id; ?>"><a href="javascript:;" onclick="editRow(<?php echo $adv->id; ?>)"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a></td>
            <td><a href="javascript:;" onclick="delRow(<?php echo $adv->id; ?>);"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td></tr>
        <?php
		} ?>
    </table>
    <script type="text/javascript">
    function addRow() {
        var postData = {
            url : 'insert_Slider',
			gid : <?php echo $groupid; ?>
		};
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                var htmlAddNew = '<td id="adv1_'+ data +'"><input type="text" id="_adv1_'+ data +'" style="width: 400px;" /></td>' +
					'<td id="adv3_'+ data +'"><input type="text" id="_adv3_'+ data +'" onclick="uploadGallery(\'_adv3_'+ data +'\')" style="width: 400px;" /></td>' +
                    '<td id="adv4_'+ data +'"><input type="text" id="_adv4_'+ data +'" placeholder="http://" style="width: 200px;" /></td>' +
                    '<td id="adv2_'+ data +'"><a href="javascript:;" onclick="saveRow('+ data +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a></td>' +
                    '<td><a href="javascript:;" onclick="delRow('+ data +');"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td>';
                $('table.tblDict tr:eq(0)').after('<tr id="dbAdv_'+ data +'" align="center">'+ htmlAddNew +'</tr>').hide().fadeIn('slow');
            }
        });
        return false;
    }
    function editRow( ID ) {
		$('#adv1_'+ ID).html('<input type="text" id="_adv1_'+ ID +'" value="'+ $('#adv1_'+ ID).text().replace(/"/g, '&quot;') + '" style="width: 400px;" />');
		$('#adv3_'+ ID).html('<input type="text" id="_adv3_'+ ID +'" value="'+ $('#adv31_'+ ID).attr('href') + '" onclick="uploadGallery(\'_adv3_'+ ID +'\')" style="width: 400px;" />');
        $('#adv4_'+ ID).html('<input type="text" id="_adv4_'+ ID +'" value="'+ $('#adv41_'+ ID).attr('href') + '" placeholder="http://" style="width: 200px;" />');
        $('#adv2_'+ ID).html('<a href="javascript:;" onclick="saveRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a>');
        return false;
    }
    function saveRow( ID ) {
		var title	= $('#_adv1_'+ ID).val();
		var image	= $('#_adv3_'+ ID).val();
        var href	= $('#_adv4_'+ ID).val();
        var postData	= {
            url	: 	'save_Slider', 
            ID	: 	ID, 
            name: 	title,
            img	: 	image,
            href:	href
        };
        
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
				$('#adv1_'+ ID).html(title);
				var imgsrc = '<?php echo FOLDER_IMG; ?>/none.gif';
				if(image){ 
					imgsrc = '<?php echo HOME_URL; ?>/timthumb.php?src='+ image +'&h=60&q=100';
				}
				$('#adv3_'+ ID).html('<a id="adv31_'+ ID +'" href="'+ image +'" target="_blank"><img src="'+ imgsrc +'" alt="" /></a>');
                $('#adv4_'+ ID).html('<a id="adv41_'+ ID +'" href="'+ href +'" target="_blank">'+ href +'</a>');
                $('#adv2_'+ ID).html('<a href="javascript:;" onclick="editRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a>');
            }
        });
        return false;
    }
    function delRow( ID ) {
        var postData = {
            url : 'delete_Slider', 
            ID	: ID
        };
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                $('#dbAdv_'+ ID).remove();
            }
        });
        return false;
    }
	</script>
    <?php
}

function partner_slider() {
	global $title, $table_prefix, $wpdb;
	echo '<h1>'. $title .'</h1><hr />';
	$groupid = 2;
	$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid = ". $groupid);
	?>
    <input type="button" value="Add new partner" class="button" onclick="addRow();" />
    <em style="font-size:10px;">Lưu ý: Kích thước hình hiển thị theo chuẩn ngang 230 pixel, kích thước chiều cao nên đồng bộ với nhau.</em>
    <table width="100%" class="tblDict">
    	<tr><th>Source</th><th>Link</th><th width="22">Edit</th><th width="22">Del</th></tr>
        <?php 
		foreach ( $mysql as $adv ) { ?>
        <tr id="dbAdv_<?php echo $adv->id; ?>" align="center">
            <td id="adv3_<?php echo $adv->id; ?>"><a id="adv31_<?php echo $adv->id; ?>" href="<?php echo $adv->source; ?>" target="_blank"><img src="<?php if( $adv->source ): echo HOME_URL .'/timthumb.php?src='. $adv->adv_Value .'&h=60&q=100'; endif; ?>" alt="" /></a></td>
            <td id="adv4_<?php echo $adv->id; ?>"><a id="adv41_<?php echo $adv->id; ?>" href="<?php echo $adv->url; ?>" target="_blank"><?php echo $adv->url; ?></a></td>
            <td id="adv2_<?php echo $adv->id; ?>"><a href="javascript:;" onclick="editRow(<?php echo $adv->id; ?>)"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a></td>
            <td><a href="javascript:;" onclick="delRow(<?php echo $adv->id; ?>);"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td></tr>
        <?php
		} ?>
    </table>
    <script type="text/javascript">
    function addRow() {
        var postData = {
            url : 'insert_Slider',
			gid : <?php echo $groupid; ?>
		};
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                var htmlAddNew = '<td id="adv3_'+ data +'"><input type="text" id="_adv3_'+ data +'" onclick="uploadGallery(\'_adv3_'+ data +'\')" style="width: 400px;" /></td>' +
                    '<td id="adv4_'+ data +'"><input type="text" id="_adv4_'+ data +'" placeholder="http://" style="width: 200px;" /></td>' +
                    '<td id="adv2_'+ data +'"><a href="javascript:;" onclick="saveRow('+ data +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a></td>' +
                    '<td><a href="javascript:;" onclick="delRow('+ data +');"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td>';
                $('table.tblDict tr:eq(0)').after('<tr id="dbAdv_'+ data +'" align="center">'+ htmlAddNew +'</tr>').hide().fadeIn('slow');
            }
        });
        return false;
    }
    function editRow( ID ) {
		$('#adv3_'+ ID).html('<input type="text" id="_adv3_'+ ID +'" value="'+ $('#adv31_'+ ID).attr('href') + '" onclick="uploadGallery(\'_adv3_'+ ID +'\')" style="width: 400px;" />');
        $('#adv4_'+ ID).html('<input type="text" id="_adv4_'+ ID +'" value="'+ $('#adv41_'+ ID).attr('href') + '" placeholder="http://" style="width: 200px;" />');
        $('#adv2_'+ ID).html('<a href="javascript:;" onclick="saveRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a>');
        return false;
    }
    function saveRow( ID ) {
		var image	= $('#_adv3_'+ ID).val();
        var href	= $('#_adv4_'+ ID).val();
        var postData	= {
            url	: 	'save_Slider', 
            ID	: 	ID, 
            img	: 	image,
            href:	href
        };
        
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
				var imgsrc = '<?php echo FOLDER_IMG; ?>/none.gif';
				if(image){ 
					imgsrc = '<?php echo HOME_URL; ?>/timthumb.php?src='+ image +'&h=60&q=100';
				}
				$('#adv3_'+ ID).html('<a id="adv31_'+ ID +'" href="'+ image +'" target="_blank"><img src="'+ imgsrc +'" alt="" /></a>');
                $('#adv4_'+ ID).html('<a id="adv41_'+ ID +'" href="'+ href +'" target="_blank">'+ href +'</a>');
                $('#adv2_'+ ID).html('<a href="javascript:;" onclick="editRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a>');
            }
        });
        return false;
    }
    function delRow( ID ) {
        var postData = {
            url : 'delete_Slider', 
            ID	: ID
        };
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                $('#dbAdv_'+ ID).remove();
            }
        });
        return false;
    }
	</script>
    <?php
}

function partner_image() {
	global $title, $table_prefix, $wpdb;
	echo '<h1>'. $title .'</h1><hr />';
	$groupid = 3;
	$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid = ". $groupid);
	?>
    <input type="button" value="Add new partner" class="button" onclick="addRow();" />
    <em style="font-size:10px;">Lưu ý: Kích thước hình hiển thị theo chuẩn ngang 230 pixel, kích thước chiều cao nên đồng bộ với nhau.</em>
    <table width="100%" class="tblDict">
    	<tr><th>Source</th><th>Link</th><th width="22">Edit</th><th width="22">Del</th></tr>
        <?php 
		foreach ( $mysql as $adv ) { ?>
        <tr id="dbAdv_<?php echo $adv->id; ?>" align="center">
            <td id="adv3_<?php echo $adv->id; ?>"><a id="adv31_<?php echo $adv->id; ?>" href="<?php echo $adv->source; ?>" target="_blank"><img src="<?php if( $adv->source ): echo HOME_URL .'/timthumb.php?src='. $adv->adv_Value .'&h=60&q=100'; endif; ?>" alt="" /></a></td>
            <td id="adv4_<?php echo $adv->id; ?>"><a id="adv41_<?php echo $adv->id; ?>" href="<?php echo $adv->url; ?>" target="_blank"><?php echo $adv->url; ?></a></td>
            <td id="adv2_<?php echo $adv->id; ?>"><a href="javascript:;" onclick="editRow(<?php echo $adv->id; ?>)"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a></td>
            <td><a href="javascript:;" onclick="delRow(<?php echo $adv->id; ?>);"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td></tr>
        <?php
		} ?>
    </table>
    <script type="text/javascript">
    function addRow() {
        var postData = {
            url : 'insert_Slider',
			gid : <?php echo $groupid; ?>
		};
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                var htmlAddNew = '<td id="adv3_'+ data +'"><input type="text" id="_adv3_'+ data +'" onclick="uploadGallery(\'_adv3_'+ data +'\')" style="width: 400px;" /></td>' +
                    '<td id="adv4_'+ data +'"><input type="text" id="_adv4_'+ data +'" placeholder="http://" style="width: 200px;" /></td>' +
                    '<td id="adv2_'+ data +'"><a href="javascript:;" onclick="saveRow('+ data +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a></td>' +
                    '<td><a href="javascript:;" onclick="delRow('+ data +');"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td>';
                $('table.tblDict tr:eq(0)').after('<tr id="dbAdv_'+ data +'" align="center">'+ htmlAddNew +'</tr>').hide().fadeIn('slow');
            }
        });
        return false;
    }
    function editRow( ID ) {
		$('#adv3_'+ ID).html('<input type="text" id="_adv3_'+ ID +'" value="'+ $('#adv31_'+ ID).attr('href') + '" onclick="uploadGallery(\'_adv3_'+ ID +'\')" style="width: 400px;" />');
        $('#adv4_'+ ID).html('<input type="text" id="_adv4_'+ ID +'" value="'+ $('#adv41_'+ ID).attr('href') + '" placeholder="http://" style="width: 200px;" />');
        $('#adv2_'+ ID).html('<a href="javascript:;" onclick="saveRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a>');
        return false;
    }
    function saveRow( ID ) {
		var image	= $('#_adv3_'+ ID).val();
        var href	= $('#_adv4_'+ ID).val();
        var postData	= {
            url	: 	'save_Slider', 
            ID	: 	ID, 
            img	: 	image,
            href:	href
        };
        
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
				var imgsrc = '<?php echo FOLDER_IMG; ?>/none.gif';
				if(image){ 
					imgsrc = '<?php echo HOME_URL; ?>/timthumb.php?src='+ image +'&h=60&q=100';
				}
				$('#adv3_'+ ID).html('<a id="adv31_'+ ID +'" href="'+ image +'" target="_blank"><img src="'+ imgsrc +'" alt="" /></a>');
                $('#adv4_'+ ID).html('<a id="adv41_'+ ID +'" href="'+ href +'" target="_blank">'+ href +'</a>');
                $('#adv2_'+ ID).html('<a href="javascript:;" onclick="editRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a>');
            }
        });
        return false;
    }
    function delRow( ID ) {
        var postData = {
            url : 'delete_Slider', 
            ID	: ID
        };
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                $('#dbAdv_'+ ID).remove();
            }
        });
        return false;
    }
	</script>
    <?php
}

function partner_links() {
	global $title, $table_prefix, $wpdb;
	echo '<h1>'. $title .'</h1><hr />';
	$groupid = 4;
	$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid = ". $groupid);
	?>
    <input type="button" value="Add new partner" class="button" onclick="addRow();" />
    <table width="100%" class="tblDict">
    	<tr><th>Link</th><th width="22">Edit</th><th width="22">Del</th></tr>
        <?php 
		foreach ( $mysql as $adv ) { ?>
        <tr id="dbAdv_<?php echo $adv->id; ?>" align="center">
            <td id="adv4_<?php echo $adv->id; ?>"><a id="adv41_<?php echo $adv->id; ?>" href="<?php echo $adv->url; ?>" target="_blank"><?php echo $adv->url; ?></a></td>
            <td id="adv2_<?php echo $adv->id; ?>"><a href="javascript:;" onclick="editRow(<?php echo $adv->id; ?>)"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a></td>
            <td><a href="javascript:;" onclick="delRow(<?php echo $adv->id; ?>);"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td></tr>
        <?php
		} ?>
    </table>
    <script type="text/javascript">
    function addRow() {
        var postData = {
            url : 'insert_Slider',
			gid : <?php echo $groupid; ?>
		};
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                var htmlAddNew = '<td id="adv4_'+ data +'"><input type="text" id="_adv4_'+ data +'" placeholder="http://" style="width: 200px;" /></td>' +
                    '<td id="adv2_'+ data +'"><a href="javascript:;" onclick="saveRow('+ data +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a></td>' +
                    '<td><a href="javascript:;" onclick="delRow('+ data +');"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_delete.gif" alt="" /></a></td>';
                $('table.tblDict tr:eq(0)').after('<tr id="dbAdv_'+ data +'" align="center">'+ htmlAddNew +'</tr>').hide().fadeIn('slow');
            }
        });
        return false;
    }
    function editRow( ID ) {
		$('#adv4_'+ ID).html('<input type="text" id="_adv4_'+ ID +'" value="'+ $('#adv41_'+ ID).attr('href') + '" placeholder="http://" style="width: 200px;" />');
        $('#adv2_'+ ID).html('<a href="javascript:;" onclick="saveRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_sync.gif" alt="" /></a>');
        return false;
    }
    function saveRow( ID ) {
		var href	= $('#_adv4_'+ ID).val();
        var postData	= {
            url	: 	'save_Slider', 
            ID	: 	ID, 
            href:	href
        };
        
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
				$('#adv4_'+ ID).html('<a id="adv41_'+ ID +'" href="'+ href +'" target="_blank">'+ href +'</a>');
                $('#adv2_'+ ID).html('<a href="javascript:;" onclick="editRow('+ ID +')"><img src="<?php echo FOLDER_IMG; ?>/admin/icon_edit.gif" alt="" /></a>');
            }
        });
        return false;
    }
    function delRow( ID ) {
        var postData = {
            url : 'delete_Slider', 
            ID	: ID
        };
        $.ajax({
            type: "POST",
            url: "<?php echo FOLDER_LIBS; ?>/actions.php",
            data: postData,
            cache: false,
            success: function(data){
                $('#dbAdv_'+ ID).remove();
            }
        });
        return false;
    }
	</script>
    <?php
}
?>